package com.he.mementomodel;

import com.he.mementomodel.caretaker.ApplyCaretaker;
import com.he.mementomodel.originator.OriginatorApply;

import java.util.Date;

public class Client {
    public static void main(String[] args) {
        OriginatorApply originatorApply = new OriginatorApply();
        originatorApply.init();
        ApplyCaretaker applyCaretaker = new ApplyCaretaker();

        applyCaretaker.setApplyMemento(originatorApply.createMemento());
        System.out.println(originatorApply);
        originatorApply.createMemento();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        originatorApply.setCtime(new Date());
        originatorApply.setAuditName("西奥给");
        System.out.println(originatorApply);
        originatorApply.restoreMemento(applyCaretaker.getApplyMemento());
        System.out.println(originatorApply);
    }
}
